#

| Chapter 17 Finding Files with find |

## 17.5 Searching for Old Files

If you want to find a file that is seven days old, use the -mtime operator:

>     % find . -mtime 7 -print

An alternate way is to specify a range of times:

>     % find . -mtime +6 -mtime -8 -print

mtime is the last modified time of a file. If you want to look for files that have not been used, check the access time with the -atime argument. A command to list all files that have not been read in 30 days or more is:

>     % find . -type f -atime +30 -print

It is difficult to find directories that have not been accessed because the find command modifies the directory's access time.

There is another time associated with each file, called the ctime, the inode (1.22) change time. Access it with the -ctime operator. The ctime will have a more recent value if the owner, group, permission, or number of links has changed, while the file itself does not. If you want to search for files with a specific number of links, use the -links operator.

Article 16.5 has more information about these three times. Article 17.7 explains how find checks them.

- BB

17.4 Looking for Files with Particular Names |  | 17.6 Be an Expert on find Search Operators